/**
 * yq info
 * url: http://localhost:3002/m1/yq/info
 */
import { httpFetch } from '../../utils/req'

const staticData = {
  code: 0,
  msg: '失败',
  data: {}
}

export default (query, request) => {
  return new Promise((resolve, reject) => {
    httpFetch(
      'https://c.m.163.com/ug/api/wuhan/app/data/list-total',
      {
        method: 'get',
        headers: {
        // 'User-Agent':
        //   'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 ' +
        //   '(KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36',
          origin: 'https://wp.m.163.com'
        }
      }
    ).promise.then(res => {
      if (res.statusCode === 200) {
        resolve(res.body)
      } else {
        resolve(staticData)
      }
    }).catch(e => {
      reject(e)
    })
  })
}
